const fs = require("fs");
exports.getMine = function (extname) {
  switch (extname) {
    case ".html":
      return "text/html";
    case ".css":
      return "text/css";
    case ".js":
      return "text/javascript";
    default:
      return "text/html";
  }
};
// exports.getFileMine = function (extname) {
//   return new Promise((resovle, reject) => {
//     fs.readFile("./utils/mime.json", (err, data) => {
//       if (err) {
//         console.log(err);
//         reject(err);
//         return;
//       }
//       let mimeObj = JSON.parse(data.toString());
//       resovle(mimeObj[extname]);
//     });
//   });
// };
exports.getFileMine = function (extname) {
  let data = fs.readFileSync("./utils/mime.json");
  let mimeObj = JSON.parse(data.toString());
  return mimeObj[extname];
};
